package org.aeon.gamechatnest.pojo;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Null;
import lombok.Data;
import org.aeon.gamechatnest.validated.Add;
import org.aeon.gamechatnest.validated.Update;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

/**
 * 服务器表
 *
 * @author : Liys 2024年5月9日
 * @TableName user_server
 */
@Data
@Schema(description = "用户服务器实体", name = "UserServer")
@TableName("user_server")
public class UserServer implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;
    /**
     * 服务器id
     */
    @Schema(description = "服务器id", name = "serverId")
    @TableId
    @Null(groups = Add.class, message = "新增时服务器id应该为空")
    @NotNull(groups = Update.class, message = "更新时服务器id不能为空")
    private Long serverId;
    /**
     * 创建用户id
     */
    @Schema(description = "用户id(外键)", name = "userId")
    @Null(groups = {Add.class, Update.class}, message = "新增、更新时用户id不能动")
    private Long userId;
    /**
     * 服务器名称
     */
    @Schema(description = "服务器名称", name = "name")
    @NotBlank(groups = {Add.class}, message = "服务器名称不能为空")
    private String name;
    /**
     * 服务器头像
     */
    @Schema(description = "服务器头像路径", name = "headImage")
    private String headImage;
    /**
     * 服务器简介
     */
    @Schema(description = "服务器简介", name = "introduce")
    private String introduce;
    /**
     * 服务器创建时间
     */
    @Schema(description = "创建时间", name = "createTime")
    @Null(groups = {Add.class, Update.class}, message = "创建时间应为空")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;
}
